//
//  APPINFO.m
//  ChatForHot
//
//  Created by FLY on 2018/10/9.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "APPINFO.h"

@implementation APPINFO

static APPINFO *_AppInfo;

+ (instancetype)defaultManager{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _AppInfo = [[APPINFO alloc] init];
    });
    return _AppInfo;
}
- (NSString *)ver{
    return [[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"];
}
- (NSString *)appid{
    
    return @"20001";
}
- (NSString *)channelId{
    if (_channelId == nil) {
        NSString *identifierStr = [[NSBundle mainBundle] bundleIdentifier];
        NSArray *arr = [identifierStr componentsSeparatedByString:@"."];
        NSString *midid;
        if (arr.count >= 2) {
            midid = arr[1];
        }else{
            midid = identifierStr;
        }
        _channelId = [@"ios-" stringByAppendingString:midid];
//        NSLog(@"%@",_channelId);
    }
    return _channelId;
}
- (void)HOTCHATreset{
    NSUserDefaults *users = [NSUserDefaults standardUserDefaults];
    self.IMPassword = [users objectForKey:@"IMPassword"];
    self.IMUser = [users objectForKey: @"IMUser"];
    self.accountNumber = [users objectForKey:@"accountNumber"];
    self.accountPassword = [users objectForKey:@"password"];
    self.password = [users objectForKey:@"password"];
    self.headPic =[users objectForKey:@"headPic"];
    self.sex = [users objectForKey: @"sex"];
    
    self.token = [users objectForKey:@"token"];
    
    self.accountid = [users objectForKey:@"accountid"];
    self.nickName = [users objectForKey:@"nickName"];
    
    self.commonPicCount = [users objectForKey:@"commonPicCount"];
    self.privatePicCount = [users objectForKey:@"privatePicCount"];
    
    self.code = [users objectForKey:@"code"];
    
    self.signature = [users objectForKey:@"signature"];
    self.age = [users objectForKey:@"age"];
    self.height = [users objectForKey:@"height"];
    self.weight = [users objectForKey:@"weight"];
    self.constellation = [users objectForKey:@"constellation"];
    self.income = [users objectForKey:@"income"];
    self.occupation = [users objectForKey:@"occupation"];
    self.minFeet = [users objectForKey:@"minFeet"];
    self.maxFeet = [users objectForKey:@"maxFeet"];
    self.isExtreme = [users objectForKey:@"isExtreme"];
    self.isWrite = [users objectForKey:@"isWrite"];
    self.isDiamonds = [users objectForKey:@"isDiamonds"];
    //2.0
    self.approvePic = [users objectForKey:@"approvePic"];
    self.isApprove = [users objectForKey:@"isApprove"];
    self.addToType = [users objectForKey:@"addToType"];
    self.addHiToType = [users objectForKey:@"addHiToType"];
    self.commonVideoCount =[users objectForKey:@"commonVideoCount"];
    self.privateVideoCount = [users objectForKey:@"privateVideoCount"];
    //test
//    self.isVIP = @"1";
    self.isVIP = (HOTCHATAPPINFO.isLock.integerValue == 1 || HOTCHATAPPINFO.isDiamonds.integerValue == 1 || HOTCHATAPPINFO.isExtreme.integerValue == 1) ? @"1" : @"0";
    //注册状态
    if (self.accountNumber.length > 0) {
        if (self.headPic.length > 0) {
            self.registerFlag = 3;
        }else{
            self.registerFlag = 1;
        }
    }else{
        self.registerFlag = -2;
    }
}
@end
